Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Quartz clustered jobs #5529

Merged
merged 2 commits into from
Nov 29, 2019
Merged

Conversation

machi1990
Copy link
Member

@machi1990 machi1990 commented Nov 16, 2019

Follows up #3783

Fixes #3520

Based on #5481, the reason behind opening as draft PR.

/cc @mkouba

Quartz Quickstart PR opened quarkusio/quarkus-quickstarts#389

@machi1990
Copy link
Member Author

Test failure related. I am still taking into account the feedbacks.

Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some comments, most of them minor.

this.dataSource = instanceHandle.get();
} else {
String message = String.format(
"JDBC Store configured but '%s' datasource is missing. You can configure your datasource by following the guide available at: https://quarkus.io/guides/datasource-guide",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"JDBC Store configured but '%s' datasource is missing. You can configure your datasource by following the guide available at: https://quarkus.io/guides/datasource-guide",
"JDBC Store configured but '%s' datasource is missing. You can configure your datasource by following the guide available at: https://quarkus.io/guides/datasource",

<artifactId>quarkus-quartz-deployment</artifactId>
<name>Quarkus - Scheduler Quartz - Deployment</name>
<artifactId>quarkus-quartz-deployment</artifactId>
<name>Quarkus - Scheduler Quartz - Deployment</name>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either "Quartz Scheduler" or "Scheduler - Quartz" or just "Quartz" but the current order looks weird.

I suppose if we judge that quarkus-quartz is good enough, it should be Quartz. Then we can detail in the description and the metadata of the extension.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go with Quartz

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, "Scheduler" was there for a good reason - it's a link to the Scheduler extension this Quartz extension is build on (and basically extends it's functionality).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see that but it's hard to grasp IMHO. Maybe something like Scheduler - Quartz might be better.

And in this case, why is the extension named quarkus-quartz and not quarkus-scheduler-quartz? Not saying I want the latter, just asking if we should be consistent somehow.

ci-templates/stages.yml Outdated Show resolved Hide resolved
integration-tests/quartz/pom.xml Outdated Show resolved Hide resolved
integration-tests/quartz/pom.xml Outdated Show resolved Hide resolved
@gsmet gsmet changed the title add support for quartz clustered job Add support for Quartz clustered jobs Nov 22, 2019
@machi1990 machi1990 force-pushed the 3520 branch 6 times, most recently from 55cea06 to a7a283a Compare November 24, 2019 14:01
Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the documentation.

@@ -20,6 +20,7 @@ include::quarkus-intro.adoc[tag=intro]
* link:lifecycle.html[Application Initialization and Termination]
* link:rest-json.html[Writing JSON REST Services]
* link:scheduler.html[Schedule Periodic Tasks]
* link:quartz.html[Scheduler Periodic Clustered Tasks]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* link:quartz.html[Scheduler Periodic Clustered Tasks]
* link:quartz.html[Schedule Periodic Clustered Tasks]

Copy link
Member Author

@machi1990 machi1990 Nov 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Schedule Periodic Tasks with Quartz ?

* an IDE
* JDK 1.8+ installed with `JAVA_HOME` configured appropriately
* Apache Maven 3.5.3+
* Docker and docker compose installed on your machine
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Docker and docker compose installed on your machine
* Docker and Docker Compose installed on your machine

include::./attributes.adoc[]

Modern applications often need to run specific tasks periodically.
In this guide, you learn how to schedule periodic clustered tasks using the http://www.quartz-scheduler.org/[Quartz extension].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In this guide, you learn how to schedule periodic clustered tasks using the http://www.quartz-scheduler.org/[Quartz extension].
In this guide, you learn how to schedule periodic clustered tasks using the http://www.quartz-scheduler.org/[Quartz] extension.


== Architecture

In this guide, we create a straightforward application accessible using HTTP to get the current list of all created tasks by schedulers running on two instances of the same application.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence is a bit confusing IMHO.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing it out. Let me revisit it.

* an `org.acme.quartz.TaskResource` resource
* an associated test

The Maven project also imports the Quarkus quartz extension.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The Maven project also imports the Quarkus quartz extension.
The Maven project also imports the Quarkus Quartz extension.

== Run the application in Dev Mode

Run the application with: `./mvnw quarkus:dev`.
After a few seconds, open another terminal and run `curl localhost:8080/tasks` to verify that we have task created.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have task created doesn't look correct.

As usual, the application can be packaged using `./mvnw clean package` and executed using the `-runner.jar` file.
You can also generate the native executable with `./mvnw clean package -Pnative`.

== Packaging the application and run several instances
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a new line after the title.

You can also generate the native executable with `./mvnw clean package -Pnative`.

== Packaging the application and run several instances
The application can be packaged using `./mvnw clean package`. Once the build is successfully, run the below command
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The application can be packaged using `./mvnw clean package`. Once the build is successfully, run the below command
The application can be packaged using `./mvnw clean package`. Once the build is successful, run the below command:

docs/src/main/asciidoc/quartz.adoc Show resolved Hide resolved
and pull requests should be submitted there:
https://github.com/quarkusio/quarkus/tree/master/docs/src/main/asciidoc
////
= Quarkus - Scheduling Periodic Clustered Tasks
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be a guide about this only? Won't we expose more Quartz features?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be renamed to Quarkus - Scheduling Periodic Tasks with Quartz ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK we don't expose any Quarzt APIs at the moment and I think it's reasonable to keep it this way because we'd like to encourage users to continue using our scheduler extension API. Therefore it's ok to name the guide like this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mkouba Yes that makes sense. I have already renamed it in the way I proposed above. I am also thinking of adding a link from the current scheduler extension to this guide with something like - use the quartz extension to schedule clustered jobs

WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have already renamed it in the way I proposed above...

Well, my comment was rather that it's ok to use "clustered" in the title because that's what this extension is for, ie. the message should be something like "if you really need clustered scheduler use the quartz extension".

I am also thinking of adding a link from the current scheduler extension to this guide with something like...

I like it! Both guides should probably reference each other?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. I’ll add it later on, thanks.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added the links to both guides.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, sorry, I thought the whole point of this extension was to expose the Quartz APIs at some point.

@machi1990 machi1990 force-pushed the 3520 branch 5 times, most recently from 2690d3f to 730f4fb Compare November 26, 2019 15:16
@@ -17,6 +17,8 @@ API or configuration properties might change as the extension matures.
Feedback is welcome on our https://groups.google.com/d/forum/quarkus-dev[mailing list] or as issues in our https://github.com/quarkusio/quarkus/issues[GitHub issue tracker].
====

TIP: If you really need clustered scheduler use the link:quartz[Quartz] extension
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
TIP: If you really need clustered scheduler use the link:quartz[Quartz] extension
TIP: If you need a clustered scheduler use the link:quartz[Quartz] extension

@gsmet
Copy link
Member

gsmet commented Nov 28, 2019

There is a conflict apparently in the doc.

I also added one last comment. Otheriwise it looks mostly good to me.

@mkouba so as for the artifact names, should we go with quarkus-scheduler-quartz, quarkus-quartz? What do you prefer?

@mkouba
Copy link
Contributor

mkouba commented Nov 28, 2019

so as for the artifact names, should we go with quarkus-scheduler-quartz, quarkus-quartz? What do you prefer?

I don't have a preference. When I created the quartz extension I used quarkus-quartz because it's shorter ;-).

@machi1990
Copy link
Member Author

There is a conflict apparently in the doc.

I also added one last comment. Otheriwise it looks mostly good to me.

@gsmet thanks for the heads up about the conflict. It should be fixed now.

I kept the name as

so as for the artifact names, should we go with quarkus-scheduler-quartz, quarkus-quartz? What do you prefer?

I don't have a preference. When I created the quartz extension I used quarkus-quartz because it's shorter ;-).

I kept quarkus-quartz :-)

@gsmet
Copy link
Member

gsmet commented Nov 29, 2019

I force pushed two very minor adjustments in the doc and extension metadata. Let's wait for CI and merge.

Thanks!

@gsmet gsmet added this to the 1.1.0 milestone Nov 29, 2019
@gsmet gsmet added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Nov 29, 2019
@machi1990
Copy link
Member Author

Thanks @gsmet @mkouba for the approval and for driving this PR home, I was mostly away for the day.

@machi1990
Copy link
Member Author

Once this goes in, we can give some love to the quickstart PR - quarkusio/quarkus-quickstarts#389 :-)

@machi1990
Copy link
Member Author

It is super green, let's merge this. Thanks @mkouba @gsmet

@machi1990 machi1990 merged commit 6ced767 into quarkusio:master Nov 29, 2019
@machi1990 machi1990 deleted the 3520 branch November 29, 2019 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make Quartz Extension configurable for clustered scheduler engine
4 participants